//package com.soilflow.job;
//
//import com.soilflow.common.core.redis.RedisCache;
//import com.soilflow.common.domain.DahuConvenient;
//import com.soilflow.info.service.IDahuConvenientService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Component
//public class UpdateViewCountJob {
//    @Autowired
//    private RedisCache redisCache;
//    @Autowired
//    private IDahuConvenientService convenientService;
//
//    @Scheduled(cron = "0/5 * * * * ?")
//    public void updateViewCount(){
//        //获取redis中的浏览量
//        Map<String, Integer> viewCountMap = redisCache.getCacheMap("DahuConvenient:number");
//
//        List<DahuConvenient> DahuConvenients = viewCountMap.entrySet()
//                .stream()
//                .map(entry -> new DahuConvenient(Long.valueOf(entry.getKey()), entry.getValue().longValue()))
//                .collect(Collectors.toList());
//        //更新到数据库中
//        System.out.println("---------1111111111111111");
//        convenientService.updateBatchById(DahuConvenients);
//    }
//}
